import request from '@/utils/request'

// 提交用户自评表单
export function CreateCompanySelfAss(data) {
  return request({
    url: '/api/company_self_assessment/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

export function updateCompanySelfAss(id, data) {
  return request({
    url: '/api/company_self_assessment/' + id + '/',
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}

// 获取所有企业的自评
export function companySelfAssList(query) {
  return request({
    url: '/api/company_self_assessment/',
    method: 'get',
    params: query
  })
}

// 下载查询结果
export function downloadCompanySelfAss(query) {
  return request({
    url: '/api/company_self_assessment/',
    method: 'get',
    params: query,
    responseType: 'arraybuffer'
  })
}

// 获取某次企业自评
export function companySelfDetail(id) {
  return request({
    url: '/api/company_self_assessment/' + id + '/',
    method: 'get'
  })
}

// 获取文件模板
export function fileTemplateList(query) {
  return request({
    url: '/api/file_template/',
    method: 'get',
    params: query
  })
}

// 进行审核
export function doCheck(id, data) {
  return request({
    url: '/api/company_self_assessment/' + id + '/check/',
    method: 'post',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}
